package com.ly.heart.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ly.common.utils.DateUtils;
import com.ly.common.utils.SecurityUtils;
import com.ly.common.utils.erp.SnowflakeIdWorker;
import com.ly.heart.mapper.OrderPaymentPlanMapper;
import com.ly.heart.service.IOrderPaymentPlanService;
import org.springframework.stereotype.Service;
import com.ly.heart.domain.OrderPaymentPlanEntity;

import javax.annotation.Resource;

/**
 * 采购订单关联付款计划Service业务层处理
 *
 * @author cxl
 * @date 2024-06-23
 */
@Service
public class OrderPaymentPlanServiceImpl extends ServiceImpl<OrderPaymentPlanMapper, OrderPaymentPlanEntity> implements IOrderPaymentPlanService {

    @Resource
    private OrderPaymentPlanMapper orderPaymentPlanMapper;

    /**
     * 查询采购订单关联付款计划
     *
     * @param id 采购订单关联付款计划ID
     * @return 采购订单关联付款计划
     */
    @Override
    public OrderPaymentPlanEntity selectOrderPaymentPlanEntityById ( String id ) {
        return orderPaymentPlanMapper.selectOrderPaymentPlanEntityById ( id );
    }

    /**
     * 查询采购订单关联付款计划列表
     *
     * @param orderPaymentPlanEntity 采购订单关联付款计划
     * @return 采购订单关联付款计划
     */
    @Override
    public List<OrderPaymentPlanEntity> selectOrderPaymentPlanEntityList ( OrderPaymentPlanEntity orderPaymentPlanEntity ) {
        return orderPaymentPlanMapper.selectOrderPaymentPlanEntityList ( orderPaymentPlanEntity );
    }

    /**
     * 新增采购订单关联付款计划
     *
     * @param orderPaymentPlanEntity 采购订单关联付款计划
     * @return 结果
     */
    @Override
    public int insertOrderPaymentPlanEntity ( OrderPaymentPlanEntity orderPaymentPlanEntity ) {
        orderPaymentPlanEntity.setId ( SnowflakeIdWorker.getInstance ().nextStringId () );
        orderPaymentPlanEntity.setUserId ( SecurityUtils.getLoginUser ().getUser ().getUserId () );
        orderPaymentPlanEntity.setCreateTime ( DateUtils.getNowDate () );
        return orderPaymentPlanMapper.insertOrderPaymentPlanEntity ( orderPaymentPlanEntity );
    }

    /**
     * 修改采购订单关联付款计划
     *
     * @param orderPaymentPlanEntity 采购订单关联付款计划
     * @return 结果
     */
    @Override
    public int updateOrderPaymentPlanEntity ( OrderPaymentPlanEntity orderPaymentPlanEntity ) {
        return orderPaymentPlanMapper.updateOrderPaymentPlanEntity ( orderPaymentPlanEntity );
    }

    /**
     * 批量删除采购订单关联付款计划
     *
     * @param ids 需要删除的采购订单关联付款计划ID
     * @return 结果
     */
    @Override
    public int deleteOrderPaymentPlanEntityByIds ( String[] ids ) {
        return orderPaymentPlanMapper.deleteOrderPaymentPlanEntityByIds ( ids );
    }

    /**
     * 删除采购订单关联付款计划信息
     *
     * @param id 采购订单关联付款计划ID
     * @return 结果
     */
    @Override
    public int deleteOrderPaymentPlanEntityById ( String id ) {
        return orderPaymentPlanMapper.deleteOrderPaymentPlanEntityById ( id );
    }
}
